<div class="row">
<style>
img{width:50px;border:none;}
.my_red{color:red;}
.my_green{color:green;}
.Tselect select{border:1px solid #CCCCCC;border-radius:5px;padding-left:5px;height: 30px;width: 100px;}
.Tselect select option{padding-left: 5px;}
.Tsearch input{height: 30px;border-radius: 5px;border: 1px solid #CCCCCC;padding-left: 5px;line-height: 30px;}
</style>
<!-- 表示一个成功的或积极的动作 -->
<div class="col-xs-6">
<a href="{:U('User/index')}"><button type="button" class="btn btn-primary active">达人管理</button></a>
<button type="button" class="btn btn-primary"  data-toggle="modal" data-target="#myModal">添加达人</button>
<button type="button" class="btn btn-primary"  data-toggle="modal" data-target="#myModal2">手动添加达人</button>
<button type="button" class="btn btn-primary"  data-toggle="modal" data-target="#myModal3">JSON采集资源</button>
</div>
<section class="col-xs-3 Tselect">
	<form role="form">
		     <select name="sortT" class="option">
		     	<option value="default">默认</option>
				<option value="new" >最新</option>
				<option value="share" >分享</option>
				<option value="album" >专辑</option>
				<option value="follow" >订阅</option>
				<option value="fans" >粉丝</option>
			</select>
		<button type="submit" class="btn btn-default">排序</button>
	</form>
</section>
<section class="col-xs-3 Tsearch">
	<form role="form">
		<input type="text" name="user" placeholder="网盘达人搜索" value="{$Think.get.user}"/>    
		<button type="submit" class="btn btn-default">搜索</button>
	</form>
</section>
<table class="table table-hover table-responsive">
   <thead>
      <tr>
         <th>达人</th>
         <th>UK</th>
         <th>分享</th>
         <th>专辑</th>
         <th>订阅</th>
         <th>粉丝</th>
         <th>状态</th>
         <th>操作</th>
         <th>收录时间</th>
      </tr>
   </thead>
   <tbody>
   <volist name="data" id="data">
      <tr>
         <td><img src="{$data.avatar}" title="{$data.show}"  data-toggle="tooltip" 
   data-placement="top"/><br><a href="{:U('Home/User/home',array('id'=>$data['id']))}" target="_blank" title="访问他在本站的主页"  data-toggle="tooltip" 
   data-placement="top">{$data.name}</a></td>
         <td><br><a href="http://yun.baidu.com/share/home?uk={$data.uk}" target="_blank"  title="访问他的百度网盘主页"  data-toggle="tooltip" 
   data-placement="top">{$data.uk}</a></td>
         <td><br><a href="http://yun.baidu.com/share/home?uk={$data.uk}&view=share"  target="_blank"  title="访问他的百度网盘分享"  data-toggle="tooltip" 
   data-placement="top">{$data.share}</a></td>
         <td><br><a href="http://yun.baidu.com/share/home?uk={$data.uk}&view=album"  target="_blank"  title="访问他的百度网盘专辑"  data-toggle="tooltip" 
   data-placement="top">{$data.album}</a></td>
         <td><br><a href="{:U('User/muti_collect_follow',array('uk'=>$data['uk'],'followNum'=>$data['follow']))}"  target="_blank"  title="多线程采集会员订阅"  data-toggle="tooltip" 
   data-placement="top">{$data.follow}</a></td>
         <td><br><a href="http://yun.baidu.com/share/home?uk={$data.uk}&view=fans"  target="_blank"  title="访问他的百度网盘粉丝"  data-toggle="tooltip" 
   data-placement="top">{$data.fans}</a></td>
         <td><br>
	         	<switch name="data.status">
					<case value="0"><span class="my_red">未采集</span></case>
					<case value="1"><span class="my_green">已采集</span></case>
					<default />待决定状态
				</switch>
         </td>
         <td><br>
			<a href="{:U('User/collect_source')}?uk={$data.uk}&shareNum={$data['share']+$data['album']}" title="马上采集该达人的资源"  data-toggle="tooltip" 
   data-placement="top">采集资源</a>
   			|  <a href="{:U('User/collect_follow')}?uk={$data.uk}&followNum={$data.follow}" title="马上采集该达人的订阅"  data-toggle="tooltip" 
   data-placement="top">采集订阅</a>
   			<!--| <a href="{:U('User/collect_fans')}?uk={$data.uk}&fansNum={$data.fans}" title="马上采集该达人的粉丝"  data-toggle="tooltip" 
   data-placement="top">采集粉丝</a>-->
   			<!--|-->  
			 <!--<if condition="$data.recommend eq 0">
			 	<a href="{:U('User/recommend')}?uk={$data.uk}&recommend=1" title="将该达人设置为推荐达人"  data-toggle="tooltip" 
   data-placement="top">推荐</a>
			 <else/>
			 	<a href="{:U('User/recommend')}?uk={$data.uk}&recommend=0" title="取消推荐该达人"  data-toggle="tooltip" 
   data-placement="top">取消推荐</a>
			 </if>-->
			 | 
			<a href="" title="查看他在本站的主页"  data-toggle="tooltip" 
   data-placement="top">查看</a>
			 <!--|--> 
			<!--<a href="{:U('User/update')}?uk={$data.uk}" title="点击再次更新该达人的达人信息"  data-toggle="tooltip" 
   data-placement="top">更新</a>
    		 |  
			<a class="delete_user" href="{:U('User/delete_user',array('uk'=>$data['uk']))}" title="删除该达人，将会删除站内收录的该达人所有的分享资源，所以请认真考虑清楚再做删除"  data-toggle="tooltip" 
   data-placement="top">删除</a>-->
         </td>
         <td><br>{$data.time|date="Y-m-d H:i:s",###}</td>
      </tr>
    </volist>
   </tbody>
</table>
{$page}

<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" 
   aria-labelledby="myModalLabel" aria-hidden="true">
   <div class="modal-dialog">
      <div class="modal-content">
         <div class="modal-body">
         <form role="form" id="collect_form" method="post" action="{:U('User/collect')}">
  			<div class="form-group">
    			<label for="content">资源达人收录</label>
    			<textarea id="content" name="content" class="form-control" rows="10" placeholder='http://yun.baidu.com/share/home?uk=4080815635&view=share#category/type=0'></textarea>
    			<span class="help-block">请输入百度网盘达人主页链接，多个请按回车换行</span>
  			</div>
		</form>
         </div>
         
         <div class="modal-footer">
            <button type="button" class="btn btn-default" 
               data-dismiss="modal">关闭
            </button>
            <button type="button" id="collect" class="btn btn-primary">
               马上采集收录
            </button>
         </div>
      </div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" 
   aria-labelledby="myModalLabel" aria-hidden="true">
   <div class="modal-dialog">
      <div class="modal-content">
       
         <div class="modal-body">
         <form role="form" id="collect_form_code" method="post" action="{:U('User/collect_code')}">
  			<div class="form-group">
    			<label for="content_code">资源达人收录</label>
    			<textarea id="content_code" name="content_code" class="form-control" rows="10" placeholder='请输入class="homeheader"中的内容，你懂的'></textarea>
  			</div>
		</form>
         </div>
         
         <div class="modal-footer">
            <button type="button" class="btn btn-default" 
               data-dismiss="modal">关闭
            </button>
            <button type="button" id="collect_code" class="btn btn-primary">
               马上采集收录
            </button>
         </div>
      </div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal3" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
   <div class="modal-dialog">
      <div class="modal-content">
         <div class="modal-body">
         <form role="form" method="post" >
  			<div class="form-group">
    			<label for="content_json">JSON资源收录</label>
    			<textarea id="content_json" name="content_json" class="form-control" rows="10" placeholder='请粘贴入json内容'></textarea>
  			</div>
		</form>
         </div>
         <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">关闭 </button>
            <button type="button" id="collect_btn_json" class="btn btn-primary">
               马上采集收录
            </button>
         </div>
      </div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>

</div>
<script>
   $(function () {$("[data-toggle='tooltip']").tooltip(); });
   $(document).ready(function(){
   	//默认选项
   		var sortT="{$Think.get.sortT}";
   		$option=$('.option option');
   		$.each($option, function() {    
   			if($(this).val() ==sortT){
   				$(this).attr('selected','selected');
   			}
   		});
   		
   		
	   $("#collect").click(function(){
		   if($("#content").val()==''){
			   alert('内容不能为空');
			   return false;
		   }else{
			   $("#collect_form").submit(); 
		   }
	   });
	   $("#collect_code").click(function(){
		   if($("#content_code").val()==''){
			   alert('内容不能为空');
			   return false;
		   }else{
			   $("#collect_form_code").submit();
		   }
	   });

	   $("#collect_btn_json").click(function(){
		   if($("#content_json").val()==''){
			   alert('内容不能为空');
			   return false;
		   }else{
			   $.post("{:U('User/collect_json')}",{content_json:$("#content_json").val()},function(data){
				   if(data==1){
					   alert('恭喜您，资源收录成功！欢迎继续添加');
					   $("#content_json").val('');
				   }else{
					   alert('很遗憾，添加失败，可能您添加的资源已在数据库中存在。');
					   $("#content_json").val('');
				   }
			   });
		   }
	   });
	   
	   //删除达人
	   $(".delete_user").click(function(){
			if(!confirm('您确定要删除该达人吗？删除该达人之后，所有收录自该达人的资源也将被删除。')) return false;
	   });
   });
</script>








